# -*- coding: utf-8 -*-
# @Time  : 2020/03/08 下午9:00
# @Author: MagicHuang
# @File  : qiandao.py


import requests
import time


url = 'https://www.zztuku.com/member-signin.html'
headers = {
    'referer': 'https://www.zztuku.com/Index-index.html',
    'cookie': 'zzTuKu_Com=tq70c808evtapgbq8fds3j27u5; BAIDU_SSP_lcr=https://graph.qq.com/oauth2.0/show?which=Login&display=pc&client_id=101393123&redirect_uri=https%3A%2F%2Fwww.zztuku.com%2FOauth-callback-type-qq.html&response_type=code&scope=get_user_info%2Cadd_share; uid=AHdXPgEyAjpUdlc4AzNcYlFqBGVTdQFu; Hm_lvt_36d091ca4167858e40c7bf39f954e3f9=1584756378,1584756511,1584756611; Hm_lpvt_36d091ca4167858e40c7bf39f954e3f9=1584854312',
    'x-requested-with': 'XMLHttpRequest',
    'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36'
}
response = requests.get(url=url, headers=headers)
now = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime())
msg = response.json()
try:
    with open('log.txt', 'a') as f:
        f.write('{} --- {}\n'.format(now, msg))
        f.close()
        print(msg)
except Exception as e:
    print(e)
